package com.suning.sawp.service.impl.dao;

import java.util.HashMap;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.suning.framework.dal.client.DalClient;
import com.suning.sawp.intf.dao.IndexCardTaskDaoService;
import com.suning.sawp.po.bi.BIIndexTaskCardEntity;

@Service
public class IndexCardTaskDaoServiceImpl implements IndexCardTaskDaoService {

    @Resource
    DalClient dalClient;
    
    @Override
    public BIIndexTaskCardEntity queryIndexTaskByStaffIdAndBizKey(String staffId, String bizKey) {
        Map<String, Object> paramMap = new HashMap<String, Object>();
        paramMap.put("staffId", staffId);
        paramMap.put("bizKey", bizKey);
        return dalClient.queryForObject("TASK_CARD.QUERY_CARD_BY_STAFF_ID_BIZ_KEY", paramMap, BIIndexTaskCardEntity.class);
    }

    @Override
    public void upsertIndexTaskCard(BIIndexTaskCardEntity entity) {
        Map<String, Object> paramMap = new HashMap<String, Object>();
        paramMap.put("id", null);
        paramMap.put("staffId", entity.getStaffId());
        paramMap.put("bizKey", entity.getBizKey());
        paramMap.put("cardType", entity.getCardType());
        paramMap.put("title", entity.getTitle());
        paramMap.put("startTime", entity.getStartTime());
        paramMap.put("endTime", entity.getEndTime());
        paramMap.put("taskTips", entity.getTaskTips());
        paramMap.put("firstNum", null);
        paramMap.put("secondNum", null);
        paramMap.put("thirdNum", null);
        paramMap.put("taskStatus", null);
        paramMap.put("wapLink", null);
        paramMap.put("partnumberAmt", null);
        paramMap.put("cateCode", null);
        paramMap.put("ext1", null);
        paramMap.put("ext2", null);
        paramMap.put("ext3", null);
        paramMap.put("ext4", null);
        paramMap.put("ext5", null);
        
        dalClient.execute("biIndexTaskCard.replace", paramMap);
    }
    
    
}
